home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************
-
- Window.h
-
- Does open a DOpus window with an "Okay" and "Cancel" button,
- a localized cycle gadget and a textgadget for doing some
- output (it's getting later harder...).
-
- *********************************************************************/
- // our standard include, but we must think about later and so I do
- // simple trick...
-
- #ifdef PARENT
- #include "/includes/Project.h"
- #else
- #include "includes/Project.h"
- #endif
-
- // we need also some other defines from these ->
- #include <libraries/gadtools.h>
- #include <intuition/gadgetclass.h>
-
- // let's make again an useful define for us
- #define GET_ID(a) (((struct Gadget *)(a->IAddress))->GadgetID)
-
- /********************************************************************/
- // now we have to declare what we want to have
- // we start with making some ID's
-
- enum
- {
- GADGET_ID_CYCLE,
- GADGET_ID_TEXT,
-
- GADGET_ID_OKAY,
- GADGET_ID_CANCEL
- };
-
- // Our cycle gadget should be localized and so we have to declare
- // an array with all ID's from our catalog description.
- // It must end with NULL !
-
- USHORT labels[] = { { MSG_CLICK_ME }, { MSG_DO_AGAIN },
- { MSG_NICE_EHH }, NULL };
-
- // We must pass some Tags as well to our gadgets
- // here only for the cycle needed
-
- struct TagItem cycle_tags[] =
- {
- GTCustom_LocaleLabels, (ULONG) &labels[0], // set our locale labels
- TAG_DONE
- };
-
- // Now we have to define the objects to be added to the window
-
- ObjectDef odef[] =
- {
- {
- OD_GADGET, CYCLE_KIND, // what and what kind
- { 1, 1, 10, 1 }, // char dimensions
- { 0, 0, 20, 4 }, // "fine tuning"
- MSG_CYCLE_GAD, // title for the gadget (only an ID)
- PLACETEXT_BELOW, // flags
- GADGET_ID_CYCLE, // ID code for this gadget
- &cycle_tags[0] // pointer to additional tags
- },
- {
- OD_GADGET, TEXT_KIND,
- { 11, 1, SIZE_MAX_LESS-1, 1 },
- { 20, 0, 0, 4 },
- NULL,
- NULL,
- GADGET_ID_TEXT,
- NULL
- },
- {
- OD_GADGET, BUTTON_KIND,
- { 1, POS_RIGHT_JUSTIFY-1, 8, 1 },
- { 0, 0, 0, 4 },
- MSG_OKAY,
- PLACETEXT_IN | BUTTONFLAG_OKAY_BUTTON,
- GADGET_ID_OKAY,
- NULL
- },
- {
- OD_GADGET, BUTTON_KIND,
- { POS_RIGHT_JUSTIFY-1, POS_RIGHT_JUSTIFY-1, 8, 1 },
- { 0, 0, 0, 4 },
- MSG_CANCEL,
- PLACETEXT_IN | BUTTONFLAG_CANCEL_BUTTON,
- GADGET_ID_CANCEL,
- NULL
- },
- { OD_END }
- };
-
- // It's high time to define the window (means the size)
-
- ConfigWindow cfgwin =
- {
- {
- POS_CENTER, POS_CENTER, // center window (left and top)
- 40, 8 // window size in char dimensions
- },
- { 0, 0, 0, 0 } // we do here no "fine tuning"...
- };
-
- /********************************************************************/
- // now we define a structure, which makes our life easier
-
- typedef struct _WindowHandle
- {
- struct Screen *screen;
- struct Window *win;
- ObjectList *olist;
- struct IntuiMessage *imsg;
- ULONG signals;
-
- APTR notify_handle;
- struct MsgPort *notify_port;
- DOpusNotify *notify_msg;
-
- FuncArgs *fargs;
- char buffer[32];
- ULONG result;
-
- } WindowHandle;
-
- /********************************************************************/
- // prototype for our function, which may be exported
-
- void OwnWindow( STRPTR args, struct Screen *screen );
-